package com.softline.documentsmall.dao;


import com.softline.documentsmall.entity.EntryDetails;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;

import java.util.List;

/**
 * @author zhongweicheng
 * @date 2020/8/25 15:32
 */
@Mapper
public interface EntryDetailMapper {

    List<EntryDetails> findByParams(@Param("entryDetails") EntryDetails entryDetails, @Param("currPage") Integer currPage, @Param("pageSize") Integer pageSize);

    void softDeleteEntryDetailById(@Param("id") Integer id);

    void updateEntryDetailById(EntryDetails entryDetails);

    void insertEntryDetail(EntryDetails entryDetails);

    EntryDetails findByDictionaryIdLanguageTitle(@Param("dictionaryId")Integer dictionaryId,@Param("language")String language,@Param("title")String title);


    /**
     * 根据词条id和排序查询记录，术语解读拍排序为1
     * @param id
     * @return
     */
    List<EntryDetails> findByDictionaryIdAndSort(Integer id);

    Integer getMaxSortByLanguageAndDic(@Param("dictionaryId")Integer dictionaryId,@Param("language")String language);

    boolean updateTitleContentByDicidLanguageAndSort(@Param("dictionaryId")Integer dictionaryId,@Param("language")String language,@Param("sort")Integer sort,@Param("title")String title,@Param("content")String content);

    List<EntryDetails> findByDictionaryIdAndType(@Param("dictionaryId")Integer dictionaryId,@Param("language")String language);

    /**
     * 根据术语ID和语种、排序查找条目详细信息
     * @param dictionaryId
     * @param language
     * @param sort
     * @return
     */
    EntryDetails findByDictionaryIdLanguageTitleSort(Integer dictionaryId, String language, Integer sort);
}
